package cn.wolfcode.shop.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Getter@Setter
public class Property extends BaseDomain{
    public static final Integer PROPERTY_TYPE_TEXT = 0; //文本框
    public static final Integer PROPERTY_TYPE_SELECTED = 1; //下拉框
    private Long catalogId; //目录id
    private String name; //属性名
    private Integer sort; //属性排序
    private Integer type; //属性类型

    private List<PropertyValue> propertyValueList;

    public String getJsonData(){
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("catalogId", catalogId);
        map.put("name", name);
        map.put("id", super.getId());
        map.put("sort", sort);
        map.put("type", type);
        return JSON.toJSONString(map);
    }
}